﻿//////////////////////////////////////////////////////////////////////////////
//
// Copyright © 1998-2024 Glodon Company Limited.
//
// Licensed under the MIT License
//
// Permission is hereby granted, free of charge, to any person obtaining a
// copy of this software and associated documentation files (the “Software”),
// to deal in the Software without restriction, including without limitation
// the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or
// sell copies of the Software, and to permit persons to whom the Software is
// furnished to do so, subject to the following conditions:
//
// The above copyright notice and this permission notice shall be included in
// all copies or substantial portions of the Software.
//
// THE SOFTWARE IS PROVIDED “AS IS”, WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
// THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
//
//////////////////////////////////////////////////////////////////////////////


#pragma once
#include "GnufModelViewDefine.h"
#include "ComponentEditorGnufUI.h"
#include "TranslatorManager.h"

extern const std::wstring FAMILY_TEXT;
extern const std::wstring IMPORTED_OBJ_TEXT ;
extern const std::wstring CAD_SHEET_CATEGORY_TEXT;
extern const std::wstring SAT_SHEET_CATEGORY_TEXT;

namespace gcmp
{
    class IDocument;
    class IFamily;
}

namespace gnuf
{
    class TreeBoard;
    class TreeNode;
}

namespace gfam
{
    enum class FamilyTreeNodeType : uint8_t
    {
        // 族
        TWNT_FAMILY_ROOT = 1,
        TWNT_FAMILY_CATEGORY,
        TWNT_FAMILY,
        TWNT_FAMILYTYPE,

        // 导入对象
        TWNT_IMPORTED_OBJECT_ROOT,
        TWNT_CAD_SHEET_CATEGORY,
        TWNT_CAD_SHEET
    };
    class GnufFamilyTreeNodeUtil
    {
    public:
        ~GnufFamilyTreeNodeUtil() {}

    public:
        static void RemoveSelectedFamlies(std::list<gnuf::TreeNode *> &selectedItem, const std::wstring &cmdId);
        static void SaveFamilyAs(gnuf::TreeNode * pTreeItem, const std::wstring &cmdId);
        static void LoadFamily(gnuf::TreeNode * pTreeItem, const std::wstring &cmdId);
        static void EditFamily(gnuf::TreeNode * pTreeItem, const std::wstring &cmdId);
        static void RenameFamily(gnuf::TreeNode * pTreeItem, const std::wstring &cmdId);
        static void CreateFamilyInstance(gnuf::TreeNode * pTreeItem, const std::wstring &cmdId);
        static void EditFamilyTypeParameter(gnuf::TreeNode * pTreeItem);

        // 删除非族导入对象
        static void RemoveImportedObject(gnuf::TreeNode* pTreeItem, const std::wstring &cmdId);

        static std::wstring GetIconPathForFamilyRootItem();
        static std::wstring GetIconPathByFamilyCategoryName(const std::wstring& categoryName);
        static std::wstring GetIconPathByFamilyName(const std::wstring& familyName);
        static std::wstring GetIconPathByFamilyTypeName(const std::wstring& familyTypeName);
        static std::wstring GetIconPathForImportedObject();
        static std::wstring GetIconPathForCADSheetCategory();
        static std::wstring GetIconPathForCADSheet();

    private:
        GnufFamilyTreeNodeUtil() {}
    };
}
